const request = require("../../utils/request.js")
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    orderId:{
      type:String,
      value:''
    },
    time:{
      type:String,
      value:""
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    goodsInfoList:[],
    status:0
  },

  /**
   * 组件的方法列表
   */
  methods: {

  },
  lifetimes: {
    attached:async function() {
        let res = await request.storeInterface(null,null,null,this.data.orderId,null,null,null,null,'getByOrderId')
        // console.log('order对应的物品',res.data.data.value)
        let goodsList = res.data.data.value
        console.log('goodsList',goodsList)
        let goodsInfoList=[]
        for(let i=0;i<goodsList.length;i++)
        {
          let res1 = await request.goodsInterface(null,null,goodsList[i].goodsId,null,null,null,null,'getById')
          goodsInfoList[i]=res1.data.data.value
          goodsInfoList[i].num=goodsList[i].num
          // goodsInfoList[i].time=goodsList[i].time
          // goodsInfoList[i].status=goodsList[i].status
          goodsInfoList[i].thumb =await request.downloadFile(goodsInfoList[i].thumb)
        }
        // console.log(goodsInfoList)
        this.setData({
          status:goodsList[0].status,
          goodsInfoList
        })
    }
  }
})
